package CustomCMS
{
	public class CMSAttributes
	{
		private var _name:String;
		private var _path:String;
		private var _type:String;
		
		public function CMSAttributes(aPath:String)
		{
			var regex:RegExp = /\*?root\*(.*?)(?:\*|$)(.*)/ig;
			
			_type = aPath.replace(regex,"$1");
			_path = aPath.replace(regex,"$2");
			var position:int = _path.lastIndexOf("*");
			position = position == -1 ? 0 : position + 1;
			_name = _path.substring(position,_path.length);
			_path = _path.substr(0,_path.lastIndexOf(_name));
		}

		public function GetPath():String
		{
			return _path;
		}
		
		public function GetFullPath():String
		{
			if( _name.length == 0)
				return _path;
			
			return _path + "*" + _name;
		}
		
		public function GetType():String
		{
			return _type;
		}
		public function GetName():String
		{
			return _name;
		}
	}
}